package containerlogistik.implementation;

import containerlogistik.interfaces.*;
import java.util.Collection;
import java.util.Set;

public class ContainerImpl extends AbstractContainer {
    
    final Mass mass;
    final Mass emptyMass;
    final Mass maxMass;    

    @Override
    public Mass mass() {
        return this.mass;
    }
    
    @Override
    public Mass emptyMass() {
        return this.emptyMass;
    }
    
    @Override
    public Mass maxMass() {
        return this.maxMass;
    }
    
    private ContainerImpl(Mass mass, Mass emptyMass, Mass maxMass, BoundingBox boundingBox) {
        this.mass = mass;
        this.emptyMass = emptyMass;
        this.maxMass = maxMass;
        this.boundingBox = boundingBox;
    }
    
    static Container valueOf(Mass mass, Mass emptyMass, Mass maxMass, BoundingBox boundingBox) {
        return new ContainerImpl(mass, emptyMass, maxMass, boundingBox);
    }

    @Override
    public boolean isFree() {
        return false;
    }

    @Override
    public boolean isBlocked() {
        return false;
    }

    @Override
    public boolean isOccupied() {
        return true;
    }

    @Override
    public boolean isEmpty() {
        return this.palletStowage.isEmpty();
    }

    @Override
    public boolean isFull() {
        return this.palletStowage.isFull();
    }

    @Override
    public int compareTo(Container o) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void load(int bayNo, int rowNo, Pallet elem) {        
        this.palletStowage.load(bayNo, rowNo, elem);
    }

    @Override
    public void load(Pallet elem) {
        this.palletStowage.load(elem);
    }

    @Override
    public void loadAll(Collection<? extends Pallet> coll) {
        this.palletStowage.loadAll(coll);
    }

    @Override
    public boolean tierIsEmpty(int bay, int row) {
        return this.palletStowage.tierIsEmpty(bay, row);
    }

    @Override
    public boolean tierIsFull(int bay, int row) {
        return this.palletStowage.tierIsFull(bay, row);
    }

    @Override
    public boolean contains(Object elem) {
        return this.palletStowage.contains(elem);
    }

    @Override
    public boolean containsAll(Collection<?> coll) {
        return this.palletStowage.containsAll(coll);
    }

    @Override
    public Pallet get(StowageLocation loc) {
        return this.palletStowage.get(loc);
    }

    @Override
    public Set<Pallet> getAll() {
        return this.palletStowage.getAll();
    }

    @Override
    public StowageLocation locationOf(Pallet elem) {
        return this.palletStowage.locationOf(elem);
    }
}
